package com.mtzqc.common.loadsir.callback

import android.content.Context
import android.view.View
import com.airbnb.lottie.LottieAnimationView
import com.kingja.loadsir.callback.Callback
import com.mtzqc.common.R

class XLoadingCallBack : Callback() {
    override fun onCreateView(): Int {
        return R.layout.common_loadsir_loading
    }

    override fun copy(): Callback? {
        return XLoadingCallBack()
    }

    var lottieView: LottieAnimationView? = null
    override fun onViewCreate(context: Context?, view: View?) {
        super.onViewCreate(context, view)
        lottieView = view?.findViewById(R.id.lottie_lav)
    }

    override fun onAttach(context: Context?, view: View?) {
        super.onAttach(context, view)
        lottieView?.playAnimation()
    }

    override fun onDetach() {
        super.onDetach()
        lottieView?.cancelAnimation()
    }
}